package com.cloud.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cloud.pojo.Admin;
import com.cloud.pojo.Permission;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface AdminMapper extends BaseMapper<Admin> {

    //删除所有管理员角色
    @Delete("delete from bz_admin_role where aid=#{aid}")
    void deleteAdminAllRole(Long aid);
    //给管理员添加角色
    @Insert("insert into bz_admin_role values (#{aid},#{rid})")
    void addRoleToAdmin(@Param("aid") Long aid, @Param("rid") Long rid);
    //根据id查询
    Admin findById(Long id);


    // 根据管理员名查询权限
    List<Permission> findAllPermission(String username);


}

